var Search = RichBase.extend({
	statics : {},
	EVENTS : {
		"click" : {
			"#serhBtn" : "onSerhBtnClick",
			"#load_out" : "onload_outClick",
		}
	},
	init : function(opt){
		this.container = opt.container;
		this.serhInp = $("#serhInp");
	},
	onSerhBtnClick : function(that,e){
		var title = that.serhInp.val();
		var cv = $("#conSelect").val();
		//console.log(provice)
		if(cv == "1")
		{
			var dname = that.serhInp.val();//供销商
			var role = "1";				
		
		}else if(cv == "2")
		{ 
			var dname = that.serhInp.val();//供应商
			var role = "2";				
		}else if(cv == "3"){
			var dname = that.serhInp.val();//分销商
			var role = "3";		
		}else{
			var dname = that.serhInp.val();//全部
			var role = "-1";
		}
		var alickData = click.getData();
		//console.log(alickData.dstatus)
		that.fire("search",{role:role,dname:dname,dstatus:alickData.dstatus});
	},
	//导出
	/* onload_outClick : function(that,e){
		var title = that.serhInp.val();
		var cv = $("#conSelect").val();
		if(cv == "1")
		{
			var dname = that.serhInp.val();//供销商
			var role = "1";	
			$(".dname_list").val(dname);
			$(".role_list").val(role);
		
		}else if(cv == "2")
		{ 
			var dname = that.serhInp.val();//供应商
			var role = "2";	
			$(".dname_list").val(dname);
			$(".role_list").val(role);			
		}else{
			var dname = that.serhInp.val();//分销商
			var role = "3";
			$(".dname_list").val(dname);
			$(".role_list").val(role);
		}
		var alickData = click.getData();
		$(".dstatus_list").val(alickData.dstatus);
		//$("form#up_form").submit();
		//that.fire("outlo",{role:role,dname:dname,dstatus:alickData.dstatus});
	}, */
	getData : function(that,e){
		var that = this;
		var cv = $("#conSelect").val();
		if(cv == "1")
		{
			var dname = that.serhInp.val();//供销商
			var role = "1";				
		
		}else if(cv == "2")
		{ 
			var dname = that.serhInp.val();//供应商
			var role = "2";				
		}else if(cv == "3"){
			var dname = that.serhInp.val();//分销商
			var role = "3";		
		}else{
			var dname = that.serhInp.val();//全部
			var role = "-1";	
		}
		return{
			role : role,
			dname : dname
		}
	}

});

$("#load_out").live("click",function(e){
		
		var title =$("#serhInp").val();
		var cv = $("#conSelect").val();
		if(cv == "1")
		{
			var dname = title;//供销商
			var role = "1";	
			$(".dname_list").val(dname);
			$(".role_list").val(role);
		
		}else if(cv == "2")
		{ 
			var dname = title;//供应商
			var role = "2";	
			$(".dname_list").val(dname);
			$(".role_list").val(role);			
		}else if(cv == "3")
		{
			var dname = title;//分销商
			var role = "3";
			$(".dname_list").val(dname);
			$(".role_list").val(role);
		}else{
			var dname = title;//全部
			var role = "-1";
			$(".dname_list").val(dname);
			$(".role_list").val(role);
			
		}
		var alickData = click.getData();
		var dstatus = alickData.dstatus;
		//$(".dstatus_list").val(alickData.dstatus);
		 window.open("http://www.12301.cc/alliance_mem.html?lists=get&role="+role+"&dname="+dname+"&dstatus="+dstatus+"&act=loadExcel");
		//that.fire("outlo",{role:role,dname:dname,dstatus:alickData.dstatus});
})